<?php
/**
 * Description of ObjectToArray
 *    convert object properties to array
 *
 * @author ben
 */
class ObjectToArray
{
    /**
    *
    * Convert an object to an array
    *
    * @param    object  $object The object to convert
    * @reeturn      array
    *
    */
    public static function toArray( $object )
    {
        if( !is_object( $object ) && !is_array( $object ) )
        {
            return $object;
        }
        if( is_object( $object ) )
        {
            $object = get_object_vars( $object );
        }
        return array_map( 'ObjectToArray::toArray', $object );
    }
}
